// declare variale in Loading State
int m_iLoadingPosX;
int m_iLoadingPosY;
boolean iColor;

Image m_imgLoading;


void UpdateLoading(int mode)
{
	if (mode == UpdateType.UPDATE)
	{
		
	} 
	if (mode == UpdateType.PAINT)
	{
		//s_g.fillRect(0, 0, SCREEN_W, SCREEN_H);
		if (m_imgOptionBG != null)
		{
			s_g.drawImage(m_imgOptionBG, 0, 0, Graphics.TOP|Graphics.LEFT);
		}
		// draw image clock	
		s_g.drawImage(m_imgLoading, 55, 50, Graphics.TOP | Graphics. LEFT);
		s_g.setColor(0x2582A7);
		s_g.setFont(Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_BOLD, Font.SIZE_LARGE));
		//s_g.drawString("Loading... Please wait", 45, 235, Graphics.LEFT | Graphics.BOTTOM);
		fonts[1].drawString("LOADING... PLEASE WAIT",(SCREEN_W>>1)+4,(SCREEN_H>>1)+55,Graphics.HCENTER,s_g);
		// draw bar loading
		s_g.setColor(c_green);		
		s_g.drawRect(43, 205, 158, 9);
		// loading bars
		s_g.setColor(c_red);		
		s_g.fillRect(44, 206, m_iLoadingPosX, 8); // xem c-ch ve
		// move bars to next pos
		m_iLoadingPosX += 2;
		if (m_iLoadingPosX > 157) { 
		    //m_iLoadingPosX = 43;
			SwitchState(GameState.AskForSounds);
			/*
			SwitchState(GameState.Splash);
			*/
		}
		// draw bg image (si e: 122 x 122)
	
	}
	if (mode == UpdateType.CTOR)
	{
		System.out.println("Loading CTOR-begin");
		m_iLoadingPosX = 0;
		m_iLoadingPosY = 206;
		try
		{  
			m_imgLoading = Image.createImage("/clock.png");
			m_imgOptionBG = Image.createImage("/bg_pink_02.png");	
            initFontSystem();
			loadFont(0);
			loadFont(1);
			loadFont(2);
			//loadSound
			loadSound("/bgMusic.mid",2);
			loadSound("/putBom.wav",1);
			loadSound("/explosion.wav",3);
		}
		catch (Exception e)
		{
			System.out.println("Loading-CTOR: Err Img loading !");
			System.out.println("e::::::::::::: " + e.getMessage());			
		}
		
		System.out.println("CTOR-end");
	}
	if (mode == UpdateType.DTOR)
	{
	    m_imgLoading = null;
        m_imgOptionBG = null;		
	}
	
}
